var e = getApp();

Page({
    data: {
        language: "",
        selected: "0",
        page: 1
    },
    onLoad: function(e) {
        this.setData({
            mid: e.id
        }), this.getData(this.data.selected, this.data.mid);
    },
    swichTabTItem: function(e) {
        this.setData({
            selected: e.detail.index,
            info: ""
        }), this.getData(this.data.selected, this.data.mid);
    },
    onReady: function() {
        var e = wx.getStorageSync("langIndex");
        this.setData({
            language: e.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        console.log(this.data.current_page), console.log(this.data.last_page), this.data.current_page < this.data.last_page ? (wx.showLoading({
            title: "加载中",
            mask: !0
        }), this.setData({
            page: this.data.page + 1
        }), this.getNext(this.data.selected)) : wx.showToast({
            title: "没有更多",
            icon: "none"
        });
    },
    getNext: function(a, t) {
        var n = this, o = "";
        "0" == a ? o = "plugin.pending-order.frontend.member-wholesale.used-log" : "1" == a ? o = "plugin.pending-order.frontend.member-wholesale.used-hang-log" : "2" == a && (o = "plugin.pending-order.frontend.member-wholesale.self-used-log");
        var s = e.getNetAddresss(o);
        e._getNetWork({
            url: s,
            data: {
                page: n.data.page,
                mw_id: t
            },
            success: function(e) {
                var a = e.data;
                if (1 == a.result) {
                    if (console.log(a), a.data.current_page > a.data.last_page) return wx.hideLoading(), 
                    wx.showToast({
                        title: "没有更多",
                        icon: "none"
                    }), void n.setData({
                        current_page: a.data.current_page,
                        last_page: a.data.last_page
                    });
                    wx.hideLoading(), n.setData({
                        info: n.data.info.concat(a.data.data),
                        current_page: a.data.current_page,
                        last_page: a.data.last_page
                    });
                } else console.log("请求失败");
            },
            fail: function(e) {
                console.log(e);
            }
        });
    },
    onShareAppMessage: function() {},
    getData: function(a, t) {
        var n = this, o = "";
        "0" == a ? o = "plugin.pending-order.frontend.member-wholesale.used-log" : "1" == a ? o = "plugin.pending-order.frontend.member-wholesale.used-hang-log" : "2" == a && (o = "plugin.pending-order.frontend.member-wholesale.self-used-log");
        var s = e.getNetAddresss(o);
        e._getNetWork({
            url: s,
            data: {
                page: this.data.page,
                mw_id: t
            },
            success: function(e) {
                var a = e.data;
                1 == a.result ? n.setData({
                    info: a.data.data,
                    current_page: a.data.current_page,
                    last_page: a.data.last_page
                }) : console.log("请求失败"), 0 == a.result && n.setData({
                    info: !1
                });
            },
            fail: function(e) {
                console.log(e);
            }
        });
    }
});